package czk.concrent.threadpool.timer;

import org.checkerframework.checker.units.qual.C;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author chenzhangkun
 * @ClassName ScheduledThreadPoolExecutorDemo
 * @description: TODO
 * @date 2024年12月06日
 */
public class ScheduledThreadPoolExecutorDemo {
	public static void main(String[] args) throws InterruptedException {

		ScheduledThreadPoolExecutor scheduledThreadPoolExecutor=new ScheduledThreadPoolExecutor(1);

		scheduledThreadPoolExecutor.scheduleAtFixedRate(()->{
			System.out.println("hello");
		},1,1,java.util.concurrent.TimeUnit.SECONDS);
		TimeUnit.SECONDS.sleep(10);
		scheduledThreadPoolExecutor.shutdownNow();
	}
}
